<?php

namespace catchAdmin\pc\controller;

use catchAdmin\pc\request\userCompany\AuditRequest;
use catcher\base\CatchRequest as Request;
use catcher\CatchResponse;
use catcher\base\CatchController;
use catchAdmin\pc\model\UserExt as UserExtModel;
use think\Response;

class UserExt extends CatchController
{

    protected $userExtModel;


    /**
     *
     * @time 2025/09/13 14:07
     * @param UserExtModel $userExtModel
     * @return mixed
     */
    public function __construct(UserExtModel $userExtModel)
    {
        $this->userExtModel = $userExtModel;
    }


    /**
     * 审核
     */
    public function audit(Request $request): Response
    {
        return CatchResponse::success($this->userExtModel->audit($request->post()));
    }

    #########################################################################################################


    /**
     *
     * @time 2025/09/13 14:07
     * @return Response
     */
    public function index(Request $request): Response
    {
        return CatchResponse::successPcList($this->userExtModel->indexData($request->param()));
    }


    /**
     *
     * @time 2025/09/13 14:07
     * @param Request $request
     * @return Response
     */
    public function save(Request $request): Response
    {
        return CatchResponse::success($this->userExtModel->storeBy($request->post()));
    }


    /**
     *
     * @time 2025/09/13 14:07
     * @param $id
     * @return Response
     */
    public function read($id): Response
    {
        return CatchResponse::success($this->userExtModel->findBy($id));
    }


    /**
     *
     * @time 2025/09/13 14:07
     * @param $id
     * @param Request $request
     * @return Response
     */
    public function update($id, Request $request): Response
    {
        return CatchResponse::success($this->userExtModel->updateBy($id, $request->post()));
    }


    /**
     *
     * @time 2025/09/13 14:07
     * @param $id
     * @return Response
     */
    public function delete($id): Response
    {
        return CatchResponse::success($this->userExtModel->deleteBy($id));
    }
}
